package com.ybxx.base.service.impl;

import java.util.List;

import org.apache.commons.lang.StringUtils;

import com.ybxx.base.dao.ReadPersonDao;
import com.ybxx.base.model.Community;
import com.ybxx.base.model.ReadPerson;
import com.ybxx.base.service.ReadPersonService;
import com.ybxx.core.command.QueryFilter;
import com.ybxx.core.dao.GenericDao;
import com.ybxx.core.service.impl.BaseServiceImpl;
import com.ybxx.core.web.paging.PagingBean;

public class ReadPersonServiceImpl extends BaseServiceImpl<ReadPerson>
		implements ReadPersonService {
	private ReadPersonDao readPersonDao;
	public ReadPersonServiceImpl(ReadPersonDao dao) {
		super(dao);
		this.readPersonDao=dao;
		// TODO Auto-generated constructor stub
	}
	public List<ReadPerson> queryPage(QueryFilter filter,String name){
		String hql="from ReadPerson as rp";
		if(StringUtils.isNotEmpty(name)){
			hql+=" where rp.pname like '%"+name+"%'";
		}
		hql+=" order by pname";
		
		return this.readPersonDao.findByHql(hql, null, filter.getPagingBean());
	}

}
